<template>
    <div>
      <detail-header></detail-header>
      <detail-banner :galleryList="galleryList" @hideDetail="hideDetail" @showDetail="showDetail"></detail-banner>
      <detail-list :list="list" v-show="!hide"></detail-list>
    </div>
</template>

<script>
import detailHeader from './components/Header'
import detailBanner from './components/Banner'
import detailList from './components/List'
import axios from 'axios'

export default {
  name: 'Detail',
  components: {
    detailHeader,
    detailBanner,
    detailList
  },
  data () {
    return {
      galleryList: [],
      list: [],
      hide: false
    }
  },
  methods: {
    hideDetail () {
      this.hide = true
    },
    showDetail () {
      this.hide = false
    },
    getDetail () {
      axios.get('/api/detail.json').then(this.getDetailSuccess)
    },
    getDetailSuccess (res) {
      res = res.data
      if (res.ret && res.data) {
        let data = res.data
        this.galleryList = data.gallaryImgs
        this.list = data.categoryList
      }
    }
  },
  mounted () {
    this.getDetail()
  }
}
</script>

<style scoped>

</style>
